package com.nf.health.app.adapter;

import android.widget.AbsListView;
import android.widget.ImageView;

import com.nf.health.app.MyApplication;
import com.nf.health.app.R;
import com.nf.health.app.models.MyDoctor;
import com.nf.health.app.utils.ImageLoaderUtils;
import com.nostra13.universalimageloader.core.ImageLoader;

import java.util.Collection;

/**
 * Created by Jason on 2016/3/17.
 */
public class RecommendDoctorAdapter extends MyBaseAdapter<MyDoctor> {
    public RecommendDoctorAdapter(AbsListView view, Collection<MyDoctor> mDatas, int itemLayoutId) {
        super(view, mDatas, itemLayoutId);
    }

    @Override
    public void convert(AdapterHolder holder, MyDoctor item, boolean isScrolling) {
        holder.setText(R.id.tv_doctor_name, item.getNick()+"("+item.getProfessional()+")");
        holder.setText(R.id.tv_hospital, item.getHospitalname());
        holder.setText(R.id.tv_goodremedy, item.getGoodremedy());
        ImageView iv_doctor_header = holder.getView(R.id.iv_doctor_head);
        if(item.getHimg() == null || item.getHimg() ==""){
            iv_doctor_header.setImageResource(R.drawable.default_doctor_icon);
        }else{
            ImageLoader.getInstance().displayImage(item.getHimg(),iv_doctor_header, MyApplication.optionsHead);
        }
    }
}
